package com.java.netty.nio.netty.inboundhandlerandoutboundhandler;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @Author: Dgg
 * @Date: 2022/1/23 17:45
 */
public class MyLongToByteEncoder extends MessageToByteEncoder<Long> {

	@Override
	protected void encode(ChannelHandlerContext channelHandlerContext, Long msg, ByteBuf byteBuf) throws Exception {
		System.out.println("MyLongToByteEncoder 被调用");
		System.out.println("msg = " + msg);
		byteBuf.writeLong(msg);
	}
}
